package com.wenwan.manage.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wenwan.manage.service.ArticleExamineService;

import javax.annotation.Resource;

/**
 * 普通文章审核过的
 * 
 * @author Admin
 *
 */
@Controller
@RequestMapping(value = "/article/examine")
public class ArticleExamineController {

	@Autowired
	private ArticleExamineService articleExamineService;

	/**
	 * 审核过的文章
	 * 
	 * @param articleId
	 *            文章Id
	 * @param isAdopt
	 *            是否通过
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/create/or/update", method = { RequestMethod.POST })
	public Map<String,Object> createOrUpdate(@RequestParam(required = true) String articleId, Boolean isAdopt) {
		return articleExamineService.createOrUpdate(articleId, isAdopt);
	}

	/**
	 * 删除审核过的文章
	 * 
	 * @param articleId
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value = "/delete/by/article/id", method = { RequestMethod.POST })
	public Map<String,Object> deleteByArticleId(@RequestParam(required = true) String articleId) {
		return articleExamineService.deleteByArticleId(articleId);
	}

}
